package com.entity;

/**
 * 购物车实体类
 */
public class Cart {

  private int id;
  private int uid;  //对应用户ID
  private int pid;     //对应商品ID
  private int value;   //数量
   private int total; //总价
    private Phone phone;


    /**
     * 计算购物车中的总金额 产品价格单价*商品数量
     * @return
     */
    public int getTotal() {

        int price = phone.getPrice();//商品价格

        return price*this.value;
    }

    public void setTotal(int total) {
        this.total = total;
    }



    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public int getPid() {
        return pid;
    }

    public void setPid(int pid) {
        this.pid = pid;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }
    public Phone getPhone() {
        return phone;
    }

    public void setPhone(Phone phone) {
        this.phone = phone;
    }

}
